using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;

namespace p301.Reports.UchetProvKons
{
    public partial class PrintUchetProvKons : DevExpress.XtraReports.UI.XtraReport
    {
        int _countC_FAKT = 0;
        int _countC_FAKT_KRIZIS = 0;
        int _countC_TEL = 0;
        int _countC_TEL_KRIZIS = 0;
        int _countC_PISMO = 0;
        int _countC_PISMO_KRIZIS = 0;
        int _countC_INET = 0;
        int _countC_INET_KRIZIS = 0;
        int _countC_GROUP = 0;
        int _countC_GROUP_LUDI = 0;

        public PrintUchetProvKons()
        {
            InitializeComponent();
        }

        public void Open(dsUchetProvKons ds)
        {
            this.DataSource = ds;
            _dsUchetProvKons = ds;
            this.ShowPreview();
        }

        private void _C_FAKT_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int fakt = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_FAKT;
            int faktKrizis = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_FAKT_KRIZIS;

            _countC_FAKT += fakt;
            _countC_FAKT_KRIZIS += faktKrizis;

            _C_FAKT.Text = fakt.ToString()+" ("+ faktKrizis.ToString()+")";  
        }

        private void _C_TEL_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int tel = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_TEL;
            int telKrizis = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_TEL_KRIZIS;

            _countC_TEL += tel;
            _countC_TEL_KRIZIS += telKrizis;

            _C_TEL.Text = tel.ToString() + " (" + telKrizis.ToString() + ")";
        }

        private void _C_PISMO_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int pismo = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_PISMO;
            int pismoKrizis = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_PISMO_KRIZIS;

            _countC_PISMO += pismo;
            _countC_PISMO_KRIZIS += pismoKrizis;

            _C_PISMO.Text = pismo.ToString() + " (" + pismoKrizis.ToString() + ")";
        }

        private void _C_INET_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int inet = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_INET;
            int inetKrizis = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_INET_KRIZIS;

            _countC_INET += inet;
            _countC_INET_KRIZIS += inetKrizis;

            _C_INET.Text = inet.ToString() + " (" + inetKrizis.ToString() + ")";
        }

        private void _C_GROUP_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int group = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_GRUP ;
            int groupLudi = _dsUchetProvKons.dtUchetProvKons[this.CurrentRowIndex].C_GRUP_LUDI ;

            _countC_GROUP += group;
            _countC_GROUP_LUDI += groupLudi;

            _C_GROUP.Text = group.ToString() + " (" + groupLudi.ToString() + ")";
        }

        private void _ITOG_FAKT_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _ITOG_FAKT.Text = _countC_FAKT.ToString() + " (" + _countC_FAKT_KRIZIS.ToString() + ")";
        }

        private void _ITOG_TEL_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _ITOG_TEL.Text = _countC_TEL.ToString() + " (" + _countC_TEL_KRIZIS.ToString() + ")";
        }

        private void _ITOG_PISMO_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _ITOG_PISMO.Text = _countC_PISMO.ToString() + " (" + _countC_PISMO_KRIZIS.ToString() + ")";
        }

        private void _ITOG_INET_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _ITOG_INET.Text = _countC_INET.ToString() + " (" + _countC_INET_KRIZIS.ToString() + ")";
        }

        private void _ITOG_GROUP_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _ITOG_GROUP.Text = _countC_GROUP.ToString() + " (" + _countC_GROUP_LUDI.ToString() + ")";
        }

    }
}
